#pragma once
#include <stdio.h>

#define NUM 1024
//无缓冲
#define BUFF_NONE 0x1
//行缓冲
#define BUFF_LINE 0x2
//全缓冲
#define BUFF_ALL 0x3


typedef struct MY_FILE{
  //file id 文件描述符
  int fd;
  //输出缓冲区
  char outputbuffer[NUM];
  //刷新方式
  int flags;
  //往缓冲区写入的位置的下标
  int current;
}MY_FILE;

MY_FILE *my_fopen(const char *path, const char *mode);

size_t my_fwrite(const void *ptr, size_t size, size_t nmemb, MY_FILE *stream);
int my_fclose(MY_FILE *fp);

int my_fflush(MY_FILE *fp);
